//-----------------------------------------------------------------------
// <copyright file="StatuService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class StatuService
    {
        #region Statu

        public static void CreateStatu(Statu statu)
        {            
            try
            {
                StatuDAO statuDAO = new StatuDAO();
                statuDAO.CreateStatu(statu);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateStatuException, ex);
            }
        }        

        public static void UpdateStatu(Statu statu)
        {            
            try
            {
                StatuDAO statuDAO = new StatuDAO();
                statuDAO.UpdateStatu(statu);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateStatuException, ex);
            }
        }        

        public static void DeleteStatu(int statusId)
        {            
            try
            {
                StatuDAO statuDAO = new StatuDAO();
                statuDAO.DeleteStatu(statusId);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteStatuException, ex);
            }
        }
        
        public static Statu GetStatu(int statusId)
        {            
            try
            {
                StatuDAO statuDAO = new StatuDAO();
                return statuDAO.GetStatu(statusId);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetStatuException, ex);
            }
        }                

        public static StatuCollection GetStatuList(StatuColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                StatuDAO statuDAO = new StatuDAO();
                return statuDAO.GetStatuList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetStatuListException, ex);
            }
        }        

        public static StatuCollection GetStatuList(StatuColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                StatuDAO statuDAO = new StatuDAO();
                return statuDAO.GetStatuList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetStatuListException, ex);
            }
        }        

	    public static StatuCollection GetStatuListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                StatuDAO statuDAO = new StatuDAO();
                return statuDAO.GetStatuListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetStatuListException, ex);
            }
        }        

        public static StatuCollection GetStatuListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                StatuDAO statuDAO = new StatuDAO();
                return statuDAO.GetStatuListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetStatuListException, ex);
            }
        }        

        #endregion
    }
}